package com.mew.chess.core.game.bjl.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author dylin
 * @create 2021/4/25
 */
public enum BjlBetType {
    BankerWin(0, 95),//"庄赢"
    IdleWin(1, 100 ),//"闲赢"
    Equal(2,800 ),//"平"
    BankerTwo(3, 1100),//"庄对"
    IdleTwo(4, 1100 ),//"闲对"

    ;

    private final int code;
    private final int rate;

    /**
     * @param code 代码
     * @param rate 倍数
     */
    private BjlBetType(final int code,int rate) {
        this.code = code;
        this.rate = rate;
    }

    private final static Map<Integer, BjlBetType> stateMap
            = Arrays.stream(BjlBetType.values()).collect(Collectors.toMap(BjlBetType::code, code -> code));

    public int code() {
        return this.code;
    }

    public int rate() {
        return this.rate;
    }


    public static BjlBetType parse(int code) {
        return stateMap.get(code);
    }
}
